SQL Operators
SQL Arithmetic Operators
+ Add
- Subtract
* Multiply
/ Divide
% Modulo
Example:
Addition:
SELECT employee_id, employee_name, salary, salary + 100 AS "salary + 100" FROM addition;
Modulo:
SELECT employee_id, employee_name, salary, salary % 25000 AS "salary % 25000" FROM addition;
The SQL WHERE Clause:
The WHERE clause is used to filter records.
It is used to extract only those records that fulfill a specified condition
SELECT column1, column2, ... FROM table_name WHERE condition;
Operators in WHERE Clause:
= Equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
<> Not equal to
BETWEEN TRUE if the operand is within the range of comparisons
IN TRUE if the operand is equal to one of a list of expressions
LIKE TRUE if the operand matches a pattern
Examples:
SELECT * FROM Products WHERE Price = 18;
SELECT * FROM Products WHERE Price > 18;
SELECT * FROM Products WHERE Price < 18;